<template>
  <div class="statisticalanalysis">
    <el-button @click="print" class="signs print" v-if="list.shStatus==2">打印</el-button>  
    <el-tooltip class="item" effect="dark" content="审核通过才可以打印" v-else placement="top-start">
      <el-button class="signs print" style="cursor:not-allowed;">打印</el-button>  
    </el-tooltip>
    <div ref="print">
        <el-card class="box-card" >
          <div style="width:100%;text-align:center;">
              <span style="height:45px;display:inline-block;line-height:45px;font-weight:700;">动土安全作业证</span>
          </div>
          <table  border="1" cellspacing="0">
            <tr align="center" height="35px">
              <td width="16%">申请单位</td>
              <td width="16%" v-text='list.sqdwmc'></td>
              <td>申请人</td>
              <td width="16%" v-text='list.sqrmc'></td>
              <td width="16%">作业证编号</td>
              <td width="16%" colspan="2" v-text='list.zyzbh'></td>
            </tr>
            <tr height="35px">
              <td align="center" colspan="1">监护人</td>
              <td colspan="5" v-text='list.jhrmc' style="padding-left:2rem;"></td>
            </tr>
            <tr align="center" height="35px">
              <td colspan="1">作业时间</td>
              <td colspan="5" style="padding-right:4rem;">
              自
                <span v-text='list.zykssj'></span>始
                <span v-text='list.zyjssj'></span>止
              </td>
            </tr>
            <tr height="35px">
              <td align="center" colspan="1">作业地点</td>
              <td colspan="5" v-text='list.zydd' style="padding-left:2rem;"></td>
            </tr>
            <tr height="35px">
              <td align="center" colspan="1">作业单位</td>
              <td colspan="5" v-text='list.zydwmc' style="padding-left:2rem;"></td>
            </tr>
            <tr height="35px">
              <td align="center" colspan="1">涉及的其他特殊作业</td>
              <td colspan="5" v-text='list.sjdqttszy' style="padding-left:2rem;"></td>
            </tr>
            <tr height="60px">
              <td colspan="6" style="border-bottom:none;padding-left:10px;">
                作业范围、内容、方式(包括深度、面积，并附简图)：
                <span v-text='list.zyfwnrfs'></span>
              </td>
            </tr>
            <tr height="60px">
              <td align="right" colspan="6" style="border-top:none;padding-right:2rem;">
                签字：
                <span v-text='list.sjdqttszyqzmc' style="padding-right:1rem;"></span>
                <span v-text='list.sjdqttszyqzrq'></span>
              </td>
            </tr>
            <tr height="80px">
              <td align="center" colspan="1">危害辨识</td>
              <td colspan="5" v-text='list.whbs' style="padding-left:2rem;"></td>
            </tr>
            <!-- 安全措施 -->
            <tr align="center" height="35px">
              <td>序号</td>
              <td colspan="4">安全措施</td>
              <td>确认人</td>
            </tr>
            <tr align="center" height="40px">
              <td>1</td>
              <td class="textleft" colspan="4">作业人员作业前已进行了安全教育</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>2</td>
              <td class="textleft" colspan="4">作业地点处于易燃易爆场所，需要动火时是否办理了动火证</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>3</td>
              <td class="textleft" colspan="4">地下电力电缆已确认保护措施已落实</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>4</td>
              <td class="textleft" colspan="4">地下通讯电（光）缆、局域网络电（光）缆已确认保护措施已落实
              </td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>5</td>
              <td class="textleft" colspan="4">地下供排水、消防管线、工艺管线已确认保护措施已落实
              </td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>6</td>
              <td class="textleft" colspan="4">已按作业方案图划线和立桩</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>7</td>
              <td class="textleft" colspan="4">动土地点有电线、管道等地下设施，应向作业单位交待并派人监护；作业时轻挖，禁止使用铁棒、铁镐或抓斗等机械工具</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>8</td>
              <td class="textleft" colspan="4">作业现场围栏、警戒线、警告牌夜间警示灯已按要求设置</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>9</td>
              <td class="textleft" colspan="4">已进行放坡处理和固壁支撑</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>10</td>
              <td class="textleft" colspan="4">人员出入口和撤离安全措施已落实：A.梯子；B.修坡道</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>11</td>
              <td class="textleft" colspan="4">道路施工作业已报：交通、消防、安全监督部门、应急中心</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>12</td>
              <td class="textleft" colspan="4">备有可燃气体检测仪、有毒介质检测仪</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>13</td>
              <td class="textleft" colspan="4">现场夜间有充足照明：A. 36V、24V、12V防水型灯；B. 36V、24V、12V防爆型灯</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>14</td>
              <td class="textleft" colspan="4">作业人员已佩戴防护器具</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>15</td>
              <td class="textleft" colspan="4">动土范围内无障碍物，已在总图上做标记</td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="80px">
              <td>16</td>
                <td colspan="4">
                <div class="tdPostion">
                  <p class="Safetymeasures">
                    其他安全措施：
                    <span v-text="list.qtaqcs"></span>
                  </p>
                </div>
                <div class="trPositon">
                  <p class="makePeopleTwo">
                    编制人：
                    <span v-text="list.bzrmc"></span>
                  </p>
                </div>
              </td>
              <td v-text='list.aqcsqrrmc'></td>
            </tr>
            <tr align="center" height="40px">
              <td>实施安全教育</td>
              <td v-text="list.ssaqjyrmc"></td>
              <td colspan="2" v-text="list.ssaqjyrmc"></td>
              <td colspan="2" v-text="list.ssaqjyrmc"></td>
            </tr>
            <tr height="60px">
              <td colspan="6" style="border-bottom:none;padding-left:10px;">
                申请单位意见：
                <span v-text="list.sqdwyj"></span>
              </td>
            </tr>
            <tr height="60px">
              <td align="right" colspan="6" style="border-top:none;padding-right:2rem;">
                签字：
                <span v-text="list.sqdwqzmc" style="padding-right:1rem;"></span>
                <span v-text="list.sqdwqzrq"></span>
              </td>
            </tr>
            <tr height="60px">
              <td colspan="6" style="border-bottom:none;padding-left:10px;">
                作业单位意见：
                <span v-text="list.zydwyj"></span>
              </td>
            </tr>
            <tr height="60px">
              <td align="right" colspan="6" style="border-top:none;padding-right:2rem;">
                签字：
                <span v-text="list.zydwyjqzmc" style="padding-right:1rem;"></span>
                <span v-text="list.zydwyjqzrq"></span>
              </td>
            </tr>
            <tr height="60px">
              <td colspan="6" style="border-bottom:none;padding-left:10px;">
                有关水、电、汽、工艺、设备、消防、安全等部门会签意见：
                <span v-text="list.sdyj"></span>
              </td>
            </tr>
            <tr height="60px">
              <td align="right" colspan="6" style="border-top:none;padding-right:2rem;">
                签字：
                <span v-text="list.sdqzmc" style="padding-right:1rem;"></span>
                <span v-text="list.sddate"></span>
              </td>
            </tr>
            <tr height="60px">
              <td colspan="6" style="border-bottom:none;padding-left:10px;">
                审批部门意见：
                <span v-text="list.spbmyj" style="padding-right:1rem;"></span>
              </td>
            </tr>
            <tr height="60px">
              <td align="right" colspan="6" style="border-top:none;padding-right:2rem;">
                签字：
                <span v-text="list.spbmqzmc" style="padding-right:1rem;"></span>
                <span v-text="list.sprq"></span>
              </td>
            </tr>
            <tr height="60px">
              <td colspan="6" style="border-bottom:none;padding-left:10px;">
                完工验收：
                <span v-text="list.wgys"></span>
              </td>
            </tr>
            <tr height="60px">
              <td align="right" colspan="6" style="border-top:none;padding-right:2rem;">
                签字：
                <span v-text="list.wgysqzmc" style="padding-right:1rem;"></span>
                <span v-text="list.wgysrq"></span>
              </td>
            </tr>
          </table>
        </el-card>
    </div>
    
  </div>
</template>

<script>
import Vue from 'vue'
import vueEsign from 'vue-esign'
import printStyle from './printStyle'
export default {
  props: ["list"],
  name:'dongtu',
  data() {
    return {
    }
  },
  created(){
    this.list.zykssj = this.formatDate(this.list.zykssj);
    this.list.zyjssj = this.formatDate(this.list.zyjssj);
    this.list.sjdqttszyqzrq = this.formatDate(this.list.sjdqttszyqzrq);
    this.list.sqdwqzrq = this.formatDate(this.list.sqdwqzrq);
    this.list.zydwyjqzrq = this.formatDate(this.list.zydwyjqzrq);
    this.list.sddate = this.formatDate(this.list.sddate);
    this.list.sprq = this.formatDate(this.list.sprq);
    this.list.wgysrq = this.formatDate(this.list.wgysrq);
  },
  methods:{
    formatDate(needTime){
      //needTime是整数，否则要parseInt转换
        if(needTime !== null && needTime !== undefined){
          var time = new Date(needTime);
          var y = time.getFullYear();
          var m = time.getMonth()+1;
          var d = time.getDate();
          var h = time.getHours();
          var mm = time.getMinutes();
          // var s = time.getSeconds();
          return y+'年'+this.add0(m)+'月'+this.add0(d)+'日'+this.add0(h)+'时'+this.add0(mm)+'分';
        }else{
          return '  年  月  日 时  分 ';
        }
    },
    add0(m){
      return m<10?'0'+m:m 
    },
    print() {
      let print = this.$refs.print.innerHTML
      let printPart = print + printStyle;
      let newTab = window.open('_blank');
      newTab.document.body.innerHTML = printPart;
      newTab.print();
      newTab.close();
    },
  },
}
</script>

<style lang="scss" scoped>
.statisticalanalysis {
  .signs {
        position: absolute;
        right: 10px;
        top: 70px;
        &.print {
            top: 20px;
            right:50px;
        }
   }
  .box-card {
    width: 80%;
    margin: 0 auto;
    background: #fff;
    color: #606266;
    position: relative;
    table {
      margin: 0 auto;
      tr {
        .textleft {
          text-align:left;
          padding-left: 20px;
        }
      }
      span {
          display:inline-block;
          min-width:70px;
      }
      // 其他安全措施
      tr:nth-child(27) {
        .trPositon {
          position: relative;
          height:90px;
          width: 100%;
          .makePeopleTwo {
            position: absolute;
            right: 15%;
            top: 60%;
          }
        }
        .tdPostion {
          position: relative;
          width: 100%;
          height: 30px;
          .Safetymeasures {
            position: absolute;
            left: 2%;
            top: 50%;
          }
        }
      }
    }
  }
}
</style>